﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class StringAppend01 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }


    protected void Button2_Click(object sender, EventArgs e)
    {
        string formate = uxText01.Text;
        if (formate.Contains("{0}") == false)
        {
            Response.Write("<script>alert('格式錯誤!!');</script>");
            return;
        }

        string[] lines = uxText02.Text.Split('\n');
        StringBuilder sb = new StringBuilder();
        uxText03.Text = "";
        foreach (string str in lines)
        {
            uxText03.Text += string.Format(formate, str.Replace('\r', ' ').Replace('\n',' ').Trim())+'\r'+'\n';
        }
    }
}
